<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>canps: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">canps
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">canps Documentation</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The Xilinx CAN driver component. This component supports the Xilinx CAN Controller.</p>
<p>The CAN Controller supports the following features:</p><ul>
<li>Confirms to the ISO 11898-1, CAN 2.0A and CAN 2.0B standards.</li>
<li>Supports both Standard (11 bit Identifier) and Extended (29 bit Identifier) frames.</li>
<li>Supports Bit Rates up to 1 Mbps.</li>
<li>Transmit message object FIFO with a user configurable depth of up to 64 message objects.</li>
<li>Transmit prioritization through one TX High Priority Buffer.</li>
<li>Receive message object FIFO with a user configurable depth of up to 64 message objects.</li>
<li>Watermark interrupts for Rx FIFO with configurable Watermark.</li>
<li>Acceptance filtering with 4 acceptance filters.</li>
<li>Sleep mode with automatic wake up.</li>
<li>Loop Back mode for diagnostic applications.</li>
<li>Snoop mode for diagnostic applications.</li>
<li>Maskable Error and Status Interrupts.</li>
<li>Readable Error Counters.</li>
<li>External PHY chip required.</li>
<li>Receive Timestamp.</li>
</ul>
<p>The device driver supports all the features listed above, if applicable.</p>
<p><b>Driver Description</b></p>
<p>The device driver enables higher layer software (e.g., an application) to communicate to the CAN. The driver handles transmission and reception of CAN frames, as well as configuration of the controller. The driver is simply a pass-through mechanism between a protocol stack and the CAN. A single device driver can support multiple CANs.</p>
<p>Since the driver is a simple pass-through mechanism between a protocol stack and the CAN, no assembly or disassembly of CAN frames is done at the driver-level. This assumes that the protocol stack passes a correctly formatted CAN frame to the driver for transmission, and that the driver does not validate the contents of an incoming frame</p>
<p><b>Operation Modes</b></p>
<p>The CAN controller supports the following modes of operation:</p><ul>
<li><b>Configuration Mode</b>: In this mode the CAN timing parameters and Baud Rate Pre-scalar parameters can be changed. In this mode the CAN controller loses synchronization with the CAN bus and drives a constant recessive bit on the bus line. The Error Counter Register are reset. The CAN controller does not receive or transmit any messages even if there are pending transmit requests from the TX FIFO or the TX High Priority Buffer. The Storage FIFOs and the CAN configuration registers are still accessible.</li>
<li><b>Normal Mode</b>:In Normal Mode the CAN controller participates in bus communication, by transmitting and receiving messages.</li>
<li><b>Sleep Mode</b>: In Sleep Mode the CAN Controller does not transmit any messages. However, if any other node transmits a message, then the CAN Controller receives the transmitted message and exits from Sleep Mode. If there are new transmission requests from either the TX FIFO or the TX High Priority Buffer when the CAN Controller is in Sleep Mode, these requests are not serviced, and the CAN Controller continues to remain in Sleep Mode. Interrupts are generated when the CAN controller enters Sleep mode or Wakes up from Sleep mode.</li>
<li><b>Loop Back Mode</b>: In Loop Back mode, the CAN controller transmits a recessive bit stream on to the CAN Bus. Any message that is transmitted is looped back to the �Rx� line and acknowledged. The CAN controller thus receives any message that it transmits. It does not participate in normal bus communication and does not receive any messages that are transmitted by other CAN nodes. This mode is used for diagnostic purposes.</li>
<li><b>Snoop Mode</b>: In Snoop mode, the CAN controller transmits a recessive bit stream on to the CAN Bus and does not participate in normal bus communication but receives messages that are transmitted by other CAN nodes. This mode is used for diagnostic purposes.</li>
</ul>
<p><b>Buffer Alignment</b></p>
<p>It is important to note that frame buffers passed to the driver must be 32-bit aligned.</p>
<p><b>Receive Address Filtering</b></p>
<p>The device can be set to accept frames whose Identifiers match any of the 4 filters set in the Acceptance Filter Mask/ID registers.</p>
<p>The incoming Identifier is masked with the bits in the Acceptance Filter Mask Register. This value is compared with the result of masking the bits in the Acceptance Filter ID Register with the Acceptance Filter Mask Register. If both these values are equal, the message will be stored in the RX FIFO.</p>
<p>Acceptance Filtering is performed by each of the defined acceptance filters. If the incoming identifier passes through any acceptance filter then the frame is stored in the RX FIFO.</p>
<p>If the Accpetance Filters are not set up then all the received messages are stroed in the RX FIFO.</p>
<p><b>PHY Communication</b></p>
<p>This driver does not provide any mechanism for directly programming PHY.</p>
<p><b>Interrupts</b></p>
<p>The driver has no dependencies on the interrupt controller. The driver provides an interrupt handler. User of this driver needs to provide callback functions. An interrupt handler example is available with the driver.</p>
<p><b>Threads</b></p>
<p>This driver is not thread safe. Any needs for threads or thread mutual exclusion must be satisfied by the layer above this driver.</p>
<p><b>Device Reset</b></p>
<p>Bus Off interrupt that can occur in the device requires a device reset. The user is responsible for resetting the device and re-configuring it based on its needs (the driver does not save the current configuration). When integrating into an RTOS, these reset and re-configure obligations are taken care of by the OS adapter software if it exists for that RTOS.</p>
<p><b>Device Configuration</b></p>
<p>The device can be configured in various ways during the FPGA implementation process. Configuration parameters are stored in the <a class="el" href="xcanps__g_8c.html">xcanps_g.c</a> files. A table is defined where each entry contains configuration information for a CAN device. This information includes such things as the base address of the memory-mapped device.</p>
<p><b>Asserts</b></p>
<p>Asserts are used within all Xilinx drivers to enforce constraints on argument values. Asserts can be turned off on a system-wide basis by defining, at compile time, the NDEBUG identifier. By default, asserts are turned on and it is recommended that users leave asserts on during development.</p>
<p><b>Building the driver</b></p>
<p>The <a class="el" href="struct_x_can_ps.html" title="The XCanPs driver instance data. ">XCanPs</a> driver is composed of several source files. This allows the user to build and link only those parts of the driver that are necessary. <br />
<br />
</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who    Date       Changes
<hr/>

1.00a xd/sv  01/12/10 First release
1.01a bss    12/27/11 Added the APIs XCanPs_SetTxIntrWatermark and
                        XCanPs_GetTxIntrWatermark.
                Updated the Register/bit definitions
                      Changed XCANPS_RXFWIR_RXFLL_MASK to XCANPS_WIR_FW_MASK
                      Changed XCANPS_RXWIR_OFFSET to XCANPS_WIR_OFFSET
                Added XCANPS_IXR_TXFEMP_MASK for Tx Fifo Empty
                Changed XCANPS_IXR_RXFLL_MASK to
                XCANPS_IXR_RXFWMFLL_MASK
                        Changed
                XCANPS_TXBUF_ID_OFFSET to XCANPS_TXHPB_ID_OFFSET
                        XCANPS_TXBUF_DLC_OFFSET to XCANPS_TXHPB_DLC_OFFSET
                XCANPS_TXBUF_DW1_OFFSET to XCANPS_TXHPB_DW1_OFFSET
                XCANPS_TXBUF_DW2_OFFSET to XCANPS_TXHPB_DW2_OFFSET
2.1 adk                 23/08/14 Fixed CR:798792 Peripheral test for CANPS IP in
                SDK claims a 40kbps baud rate but it's not.
3.0 adk     09/12/14  Added support for Zynq Ultrascale Mp.Also code
                modified for MISRA-C:2012 compliance.
3.1 adk     10/11/15  Fixed CR#911958 Add support for Tx Watermark example.
                Data mismatch while sending data less than 8 bytes.
3.1 nsk     12/21/15  Updated XCanPs_IntrHandler in <a class="el" href="xcanps__intr_8c.html">xcanps_intr.c</a> to handle
                error interrupts correctly. CR#925615
    ms      03/17/17  Added readme.txt file in examples folder for doxygen
                      generation.
</pre> </div></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
